home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / edit / pt20pc.zip / FILES.C < prev    next >
C/C++ Source or Header  |  1991-02-04  |  955b  |  48 lines

  1. #include "stdio.h"
  2. #include "dos.h"
  3. #include "conio.h"
  4.  
  5. static unsigned char dta[64];
  6. long counts[256];
  7.  
  8. main(argc, argv)
  9.     int argc;
  10.     char *argv[];
  11. {
  12.     int i, n;
  13.     union REGS rin, rout;
  14.     
  15.     if( argc < 2 ) {
  16.         printf("usage: files filePattern\n");
  17.         exit(1);
  18.     }
  19.  
  20.     /* set DTA */
  21.     rin.h.ah = 0x1A;
  22.     rin.x.dx = (int)dta;
  23.     intdos(&rin, &rout);
  24.     
  25.     /* find first file */
  26.     rin.h.ah = 0x4E;
  27.     rin.x.cx = 0x0;
  28.     rin.x.dx = (unsigned int)argv[1];
  29.     intdos(&rin, &rout);
  30.     printf("find first: ax=%d cflag=%d", rout.x.ax, rout.x.cflag);
  31.     if( argc > 2 )
  32.         for(i = 0; i < 21; ++i)
  33.             printf("%02X ", dta[i]);
  34.     
  35.     /* loop and find the other files */
  36.     while( (rout.x.cflag & 1) == 0 ) {
  37.         printf("file <%s>\n", &dta[30]);
  38.         
  39.         /* find next files */
  40.         rin.h.ah = 0x4F;
  41.         intdos(&rin, &rout);
  42.         printf("find next: ax=%d cflag=%d", rout.x.ax, rout.x.cflag);
  43.         if( argc > 2 )
  44.             for(i = 0; i < 21; ++i)
  45.                 printf("%02X ", dta[i]);
  46.     }
  47. }
  48.